# $Id: PKGBUILD 17290 2008-10-28 00:15:16Z allan $
# Contributor: Greg Grabinski <greg@grabinski.ch>
# Maintainer: ndreas Radke <andyrtr@archlinux.org>

pkgname=streamtuner-cn
_realpkgname=streamtuner
pkgver=0.99.99
pkgrel=10
pkgdesc="A stream directory browser"
arch=('i686' 'x86_64')
url="http://www.nongnu.org/streamtuner/"
license=('custom')
depends=('taglib' 'libxml2' 'gtk2' 'curl>=7.16.2' 'pygtk>=2.13.0-2')
conflicts=('streamtuner-live365')
replaces=('streamtuner-live365')
source=(http://savannah.nongnu.org/download/streamtuner/$_realpkgname-$pkgver.tar.gz \
        http://savannah.nongnu.org/download/streamtuner/streamtuner-0.99.99-live365.diff \
        http://savannah.nongnu.org/download/streamtuner/streamtuner-0.99.99-pygtk-2.6.diff          $_realpkgname.po  $_realpkgname.desktop
	streamtuner-0.99.99-shoutcast.diff
	shoutcast-redesign-patch.diff)
options=('!libtool' '!emptydirs')
md5sums=('2027b7c34e85b594524b0b4351c14362'
         '8aa1994a849b05d2b8fffbda702b8a25'
         '7aff45a41c60358cb2332c7ce644f661'
         '1eab6edce130e1a1e5f208cd3ed6766a'
         '8a3a17a1719a79353d6ad7ac8564947b')

build() {
  cd ${srcdir}/${_realpkgname}-${pkgver}
  patch -p0 -i ${srcdir}/streamtuner-0.99.99-live365.diff || return 1
  patch -p0 -i ${srcdir}/streamtuner-0.99.99-pygtk-2.6.diff || return 1
  # fix http://bugs.archlinux.org/task/10308
  patch -p0 -i ${srcdir}/streamtuner-0.99.99-shoutcast.diff || return 1
  # fix http://bugs.archlinux.org/task/11463
  patch -p1 -i ${srcdir}/shoutcast-redesign-patch.diff || return 1
  ./configure --prefix=/usr
  make || return 1
  make prefix=${pkgdir}/usr install

  install -Dm0644 ${srcdir}/$_realpkgname.desktop ${pkgdir}/usr/share/applications/

  #Add license file
  install -Dm0644 ${srcdir}/${_realpkgname}-${pkgver}/COPYING ${pkgdir}/usr/share/licenses/${_realpkgname}/COPYING

  # 中文翻译
  msgfmt ${srcdir}/${_realpkgname}.po -o ${_realpkgname}.mo
  install -m755 -d ${pkgdir}/usr/share/locale/zh_CN/LC_MESSAGES/
  cp -f ${_realpkgname}.mo $pkgdir/usr/share/locale/zh_CN/LC_MESSAGES/   
}
